<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../../assets/font/iconfont.css">
    <style>
        body{
            padding-bottom: 800px;
        }
        .iconfont{
            font-size: 40px;
        }
        icon{
            font-family: "iconfont" !important;
            font-size: 40px;
        }
        icon-home{
            font-family: "iconfont" !important;
            font-size: 40px;
            display: block;
        }
        icon-home::before{
            content: "\e8ff";
        }
    </style>
</head>
<body>
    <div class="iconfont">&#xe8ff;</div>
    <div class="iconfont icon-home"></div>
    <icon>&#xe8ff;</icon>
    <icon-home></icon-home>
    <hr>
    <div id="app">
        <div class="iconfont">&#xe8ff;</div>
        <div class="iconfont icon-home"></div>
        <!-- 
            忽略自定义标签名的配置
                通过全局应用配置 app.config.compilerOptions.isCustomElement 设置需要被忽略的自定义标签
                isCustomElement = function(tag){}  => 该方法在vue页面元素解析时会对页面所有自定义标签调用该方法
                                                   通过方法return的boolean结果判断该标签是组件标签还是普通标签
        -->
        <icon>&#xe8ff;</icon>
        <icon-home></icon-home>
        <br>
        <test-comp></test-comp>
    </div>
    <script type="text/x-template" id="TestComp">
        <h4>自定义TestComp组件</h4>
    </script>
    <script type="module"> 
        import { createApp } from "../../assets/vue3/vue.esm-browser.js";
        const app = createApp({
            components: {
                TestComp:{
                    template:"#TestComp"
                }
            },
            data(){
                return {

                }
            }
        })
        app.config.compilerOptions.isCustomElement = function(tag){
            console.log(tag)
            // return true // true表示自定义标签不需要解析 false表示组件标签需要解析
            // return tag=="icon";
            return tag=="icon"||tag.startsWith("icon-")
        }
        app.mount("#app")
    </script>
</body>
</html>